import { BasicColumn, FormSchema } from '@/components/Table';

import { DatePicker } from 'ant-design-vue';
import { h } from 'vue';

type CheckedType = boolean | string | number;

const base: BasicColumn[] = [
  {
    title: 'ms外协加工单号',
    field: 'orderNo',
    width: 150,
    showOverflow: 'title',
  },
  {
    title: '供应商编号',
    field: 'supplierNo',
    width: 100,
    showOverflow: 'title',
  },
  {
    title: '供应商名称',
    field: 'supplierName',
    showOverflow: 'title',
  },
  {
    title: '签单日期',
    field: 'orderDate',
    width: 110,
    showOverflow: 'title',
  },
  {
    title: '物料编号',
    field: 'materialNo',
    showOverflow: 'title',
    width: 120,
  },
  {
    title: '物料名称',
    field: 'materialName',
    showOverflow: 'title',
  },
  {
    title: '物料规格',
    field: 'specification',
    showOverflow: 'title',
  },
  {
    title: '物料型号',
    width: 100,
    field: 'model',
    showOverflow: 'title',
  },
  {
    title: '下单数量',
    field: 'orderNum',
    showOverflow: 'title',
    width: 100,
  },
  {
    title: '批号',
    field: 'no',
    showOverflow: 'title',
    width: 130,
  },
  {
    title: '备注',
    field: 'remark',
    showOverflow: 'title',
    width: 100,
  },
];

export const columns = base;
export const out_columns = base;

export const searchFormSchema: FormSchema[] = [
  {
    span: 5,
    field: 'orderNo',
    title: '外协加工单号',
    itemRender: {
      name: 'AInput',
    },
  },
  {
    span: 5,
    field: 'supplierName',
    title: '供应商名称',
    itemRender: {
      name: 'AInput',
    },
  },
  {
    span: 5,
    field: 'materialName',
    title: '物料名称',
    itemRender: {
      name: 'AInput',
    },
  },
  {
    span: 5,
    field: 'orderDateStart',
    title: '签单起始日期',
    itemRender: {
      name: 'ADatePicker',
      props: {
        valueFormat: 'YYYY-MM-DD',
        format: 'YYYY-MM-DD',
      },
    },
  },
  {
    span: 5,
    itemRender: {
      name: 'VxeButtonGroup',
      options: [
        { type: 'reset', content: '重置' },
        { type: 'submit', content: '查询', status: 'primary' },
      ],
    },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'userName',
    label: '成员名称',
    required: true,
    component: 'Input',
  },
  {
    field: 'isRead',
    label: '是否参与读书',
    component: 'Select',
    componentProps: {
      options: [
        { label: '否', value: 0 },
        { label: '是', value: 1 },
      ],
    },
  },
];
